package com.titanrise.crm.common.constants;

import com.titanrise.crm.environment.annotation.Component;
import com.titanrise.crm.environment.ioc.ConfigLoader;
import lombok.Getter;

/**
 * @Description:
 * @Author: pront
 * @Time:2024-11-02 12:29
 */

@Getter
@Component
public class ApplicationConstant {

    /**
     * 项目基本包名
     */
    private String basePackageName;

    /**
     * jdbc username
     */
    private String jdbcUsername;

    /**
     * jdbc password
     */
    private String jdbcPassword;

    /**
     * jdbc url
     */
    private String jdbcUrl;

    /**
     * resource file name
     */
    public static String RESOURCE_FILE_NAME = "application.properties";


    public ApplicationConstant(){
        // 加载配置文件
        ConfigLoader configLoader = new ConfigLoader(RESOURCE_FILE_NAME);
        this.basePackageName = configLoader.getProperty("java.project.package.name");
        this.jdbcUsername = configLoader.getProperty("java.mysql.jdbc.username");
        this.jdbcPassword = configLoader.getProperty("java.mysql.jdbc.password");
        this.jdbcUrl = configLoader.getProperty("java.mysql.jdbc.url");
    }
}
